#include "widget.h"
#include "ui_widget.h"

#include <QLineEdit>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    QLineEdit* lineEdit1 = new QLineEdit("NoFocus", this);
    QLineEdit* lineEdit2 = new QLineEdit("TabFocus", this);
    QLineEdit* lineEdit3 = new QLineEdit("ClickFocus", this);
    QLineEdit* lineEdit4 = new QLineEdit("StrongFocus", this);
    //  滑轮聚焦需要将鼠标放在对应的LineEdit控件上，然后滚动一下
    QLineEdit* lineEdit5 = new QLineEdit("WheelFocus", this);
    QLineEdit* lineEdit6 = new QLineEdit("WheelFocus", this);

    lineEdit1->move(200,20);
    lineEdit2->move(200,70);
    lineEdit3->move(200,120);
    lineEdit4->move(200,170);
    lineEdit5->move(200,220);
    lineEdit6->move(200,270);

    lineEdit1->setFocusPolicy(Qt::FocusPolicy(Qt::NoFocus));
    lineEdit2->setFocusPolicy(Qt::FocusPolicy(Qt::TabFocus));
    lineEdit3->setFocusPolicy(Qt::FocusPolicy(Qt::ClickFocus));
    lineEdit4->setFocusPolicy(Qt::FocusPolicy(Qt::StrongFocus));
    lineEdit5->setFocusPolicy(Qt::FocusPolicy(Qt::WheelFocus));
    lineEdit6->setFocusPolicy(Qt::FocusPolicy(Qt::WheelFocus));
}

Widget::~Widget()
{
    delete ui;
}

